package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.TempDaoUserCollectionHold;
import com.sc.nft.mapper.TempDaoUserCollectionHoldMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 刘国航
 * @desc
 * @since 2024/10/31 15:28
 */
@Slf4j
@Repository
public class TempDaoUserCollectionHoldDao extends ServiceImpl<TempDaoUserCollectionHoldMapper, TempDaoUserCollectionHold> {

    /**
     * 根据导出记录查询
     *
     * @param exportRecordId
     * @return
     */
    public List<TempDaoUserCollectionHold> listByExportRecord(Long exportRecordId) {
        LambdaQueryWrapper<TempDaoUserCollectionHold> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TempDaoUserCollectionHold::getExportRecordsId, exportRecordId);
        wrapper.orderByDesc(TempDaoUserCollectionHold::getHoldCount);
        return list(wrapper);
    }

}
